example/randr: check the GetOutputInfo's mode length (virtual head can have zero mode)
This commit is contained in:
		@@ -45,10 +45,12 @@ func main() {
 | 
				
			|||||||
			log.Fatal(err)
 | 
								log.Fatal(err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		bestMode := info.Modes[0]
 | 
							if len(info.Modes) > 0 {
 | 
				
			||||||
		for _, mode := range resources.Modes {
 | 
								bestMode := info.Modes[0]
 | 
				
			||||||
			if mode.Id == uint32(bestMode) {
 | 
								for _, mode := range resources.Modes {
 | 
				
			||||||
				fmt.Printf("Width: %d, Height: %d\n", mode.Width, mode.Height)
 | 
									if mode.Id == uint32(bestMode) {
 | 
				
			||||||
 | 
										fmt.Printf("Width: %d, Height: %d\n", mode.Width, mode.Height)
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user